package com.github.cyf.async.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author chenyifan
 * @create 2024-03-17 19:00
 */
@Slf4j
public class CustomAsyncExceptionHandler implements AsyncUncaughtExceptionHandler {

    @Override
    public void handleUncaughtException(Throwable throwable, Method method, Object... obj) {
        log.info("异常捕获---------------------------------");
        log.info("Exception message - " + throwable.getMessage());
        log.info("Method name - " + method.getName());
        log.info("Parameter value - " + Arrays.toString(obj));
        log.info("异常捕获---------------------------------");
    }
}